<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/static/commons/taglibs.jsp"%> 
<%@ include file="/static/commons/meta.jsp"%>
<%@ include file="/static/commons/jquery-easyui.jsp"%>
<html >
	<link href="${ctx}/static/styles/frame/basic.css" type="text/css" rel="stylesheet" />
	<!-- 工作台样式 -->
	<link href="${ctx}/static/styles/frame/work_space.css" type="text/css" rel="stylesheet" />
	<head>
		<title>${title }</title>
		<script language="JavaScript" src="${ctx}/static/scripts/waiting.js"></script>
 		<script language="JavaScript" src="${ctx}/static/scripts/crud.js"></script>
 		<script language="JavaScript" src="${ctx}/static/scripts/util.js"></script>
 			 <script type="text/javascript" src="${ctx}/static/scripts/common.js"></script>
	</head>
	
	<body  onload="init()">
		<div class="float_main_box">
			<!-- 中间内容 -->
			<div class="zindex">
			<!-- 车辆归还 -->
			<div class="float_main" id="float_main1" style="display:none;width:300px;margin-left:20px;float:left;">
				<p style="padding:5px;">
				 <span>待归还车辆</span>
				</p>
				<hr style="margin:0px 8px 0px 8px;" />
				 <div class="listFrame" style="width: 100%;height:80%;">
				 	<form action="${ctx}/carReturn/returnCarlist" method="post"></form>
		        	<iframe name="carlistFrame" id="carlistFrame" frameBorder="0"
						scrolling="auto" style="width: 100%;height:100%;">
					</iframe>
					<input class="zbutton" type="button" onclick="jump()" value="归还车俩"></input>
		        </div>
			</div>
			<!-- 任务分配 -->
			<div class="float_main" id="float_main2"  style="display:none;width:300px;margin-left:20px;float:left;">
				<p style="padding:5px;">
				 <span>任务分配</span>
				</p>
				<hr style="margin:0px 8px 0px 8px;" />
				 <div class="listFrame" style="width: 100%;height:80%;">
				 	<form action="${ctx}/taskAssign/getTaskInfo" method="post"></form>
		        	<iframe name="taskAssignFrame" id="taskAssignFrame" frameBorder="0"
						scrolling="auto" style="width: 100%;height:100%;">
					</iframe>
		        </div>
			</div>
			<!-- 我的通知 -->
			<div class="float_main" id="float_main3"  style="display:none;width:300px;margin-left:20px;float:left;">
				<p style="padding:5px;">
				 <span>我的通知</span>
				</p>
				<hr style="margin:0px 8px 0px 8px;" />
				<div class="listFrame" style="width: 100%;height:80%;">
				 	<form action="${ctx}/notice/getMyNotice" method="post"></form>
			        	<iframe name="noticeFrame" id="noticeFrame" frameBorder="0"
							scrolling="auto" style="width: 100%;height:100%;">
						</iframe>
					<input class="zbutton" type="button" onclick="jumpNoticeList()" value="查看通知"></input>
		        </div>
			</div>
			<!-- 检测维修任务 -->
			<div class="float_main" id="float_main4"  style="display:none;width:300px;margin-left:20px;float:left;">
				<p style="padding:5px;">
				 <span>检测维修任务</span>
				</p>
				<hr style="margin:0px 8px 0px 8px;" />
				<form action="${ctx}/myTesting/getMyTestingCount" method="post"></form>
		        	<iframe name="testFrame" id="testFrame" frameBorder="0"
						scrolling="auto" style="width: 100%;height:100%;">
					</iframe>
					
			</div>
			<!-- 证书制作-->
			<div class="float_main" id="float_main5"  style="display:none;width:300px;margin-left:20px;float:left;">
				<p style="padding:5px;">
				 <span>证书制作</span>
				</p>
				<hr style="margin:0px 8px 0px 8px;" />
				<form action="${ctx}/bsOrder/getCheckCount" method="post"></form>
				<iframe name="checkCountFrame" id="checkCountFrame" frameBorder="0"
						scrolling="auto" style="width: 100%;height:100%;">
				</iframe>
				
			</div>		
			<!-- 开票申请-->
		    <div class="float_main" id="float_main6"  style="display:none;width:300px;margin-left:20px;float:left;">
				<p style="padding:5px;">
				 <span>开票申请</span>
				</p>
				<hr style="margin:0px 8px 0px 8px;" />
				<div class="listFrame" style="width: 100%;height:80%;">
				    <form action="${ctx}/billing/getBillingSalelingCount" method="post"></form>
					<iframe name="billingSCountFrame" id="billingSCountFrame" frameBorder="0"
							scrolling="auto" style="width: 100%;height:100%;">
					</iframe>		
					<input class="zbutton" type="button" onclick="jumpBillingApply()" value="查看开票申请"></input>			
				</div>
			</div>	
			<!-- 待开票(财务)-->
		    <div class="float_main" id="float_main7"  style="display:none;width:300px;margin-left:20px;float:left;">
				<p style="padding:5px;">
				 <span>开票</span>
				</p>
				<hr style="margin:0px 8px 0px 8px;" />
				<div class="listFrame" style="width: 100%;height:80%;">
				    <form action="${ctx}/billing/getBillingCount" method="post"></form>
					<iframe name="billingCountFrame" id="billingCountFrame" frameBorder="0"
							scrolling="auto" style="width: 100%;height:100%;">
					</iframe>		
					<input class="zbutton" type="button" onclick="jumpOpenBilling()" value="开票"></input>			
				</div>
			</div>
			
			<!-- 采购申请-->
			<div class="float_main" id="float_main8"  style="display:none;width:300px;margin-left:20px;float:left;">
				<p style="padding:5px;">
				 <span>采购申请</span>
				</p>
				<hr style="margin:0px 8px 0px 8px;" />
				<div class="listFrame" style="width: 100%;height:80%;">
				   <form action="${ctx}/buyAudit/getApplyCount" method="post"></form>
					<iframe name="buyApplyFrame" id="buyApplyFrame" frameBorder="0"
							scrolling="auto" style="width: 100%;height:100%;">
					</iframe>
					<input class="zbutton" type="button" onclick="jumpBuyAuditApply()" value="查看采购申请"></input>
				</div>
			</div>
			
			<!-- 主管采购审批-->
			<div class="float_main" id="float_main9"  style="display:none;width:300px;margin-left:20px;float:left;">
				<p style="padding:5px;">
				 <span>主管采购审批</span>
				</p>				
				<hr style="margin:0px 8px 0px 8px;" />
				<div class="listFrame" style="width: 100%;height:80%;">
				   <form action="${ctx}/buyAudit/getDirCheckCount" method="post"></form>
					<iframe name="dirCheckFrame" id="dirCheckFrame" frameBorder="0"
							scrolling="auto" style="width: 100%;height:100%;">
					</iframe>
					<input class="zbutton" type="button" onclick="jumpBuyAudit()" value="查看采购审批"></input>
				</div>
			</div>
			<!-- 总经理采购审批-->
			<div class="float_main" id="float_main10"  style="display:none;width:300px;margin-left:20px;float:left;">
				<p style="padding:5px;">
				 <span>总经理采购审批</span>
				</p>
				<hr style="margin:0px 8px 0px 8px;" />
				<div class="listFrame" style="width: 100%;height:80%;">
				<form action="${ctx}/buyAudit/getManCheckCount" method="post"></form>
					<iframe name="manCheckFrame" id="manCheckFrame" frameBorder="0"
							scrolling="auto" style="width: 100%;height:100%;">
					</iframe>
					<input class="zbutton" type="button" onclick="jumpBuyAudit()" value="查看采购审批"></input>
				</div>
			</div>			
			
			</div>
			
			<!-- 中间内容 @end -->
		</div>
	</body>
	<script type="text/javascript">
		var headers = {};
		var menuList = '${jsonData}';
		var menuListObject =(eval('(' + menuList + ')'));
		headers['__RequestVerificationToken'] = "${RequestVerificationToken}";
		var defTabName = "首页";
		var pp = parent;
		function init(){
			search();
			$('.easyui-combobox').combobox();
		}
		function search(){
			waiting();
			document.forms[0].target = "carlistFrame";
			document.forms[0].submit();
			
			document.forms[1].target = "taskAssignFrame";
			document.forms[1].submit();
			
			document.forms[2].target = "noticeFrame";
			document.forms[2].submit();
			
			document.forms[3].target = "testFrame";
			document.forms[3].submit();
			
			document.forms[4].target = "checkCountFrame";
			document.forms[4].submit();
			
			//总经理待审核数量
			document.forms[5].target = "billingSCountFrame";
			document.forms[5].submit();
			
			//开票申请统计
			document.forms[6].target = "billingCountFrame";
			document.forms[6].submit();
			
			//采购申请统计
			document.forms[7].target = "buyApplyFrame";
			document.forms[7].submit();
			
			//主管待审核数量
			document.forms[8].target = "dirCheckFrame";
			document.forms[8].submit();			
			
			//总经理待审核数量
			document.forms[9].target = "manCheckFrame";
			document.forms[9].submit();
			
            for(var i=0;i<menuListObject.length;i++){
				console.log(menuListObject[i]);
				var curr =menuListObject[i];
				if(curr.menu_name == '我要还车'){
					$("#float_main1").show();
				}else if(curr.menu_name == '任务分配'){
					$("#float_main2").show();
				}else if(curr.menu_name == '我的通知'){
					$("#float_main3").show();
				}else if(curr.menu_name == '维修任务'){
					$("#float_main4").show();
				}else if(curr.menu_name == '证书制作'){
					$("#float_main5").show();
				}else if(curr.menu_name == '开票申请'&& curr.menu_id =='02.03.01'){
					$("#float_main6").show();
				}else if(curr.menu_name == '订单开票'){
					$("#float_main7").show();
				}else if(curr.menu_name == '采购申请'){
					$("#float_main8").show();
				}else if(curr.menu_name == '主管审核'){
					$("#float_main9").show();
				}else if(curr.menu_name == '经理审核'){
					$("#float_main10").show();
				}
			} 
			
			
		}
		function jump(){
			addTab("我要还车","${ctx}/carReturn/init?menuId=06.01.02","06.01.02");
		}
		
		function jumpNoticeList(){
			addTab("我要还车","${ctx}/carReturn/init?menuId=06.01.02","06.01.02");
		}
		
		//跳转采购申请页面
		function jumpBuyAuditApply(){
			addTab("采购申请","${ctx}/buyAudit/init?menuId=04.01.01","04.01.01");
		}
		//跳转采购审批页面
		function jumpBuyAudit(){
			addTab("采购审批","${ctx}/buyAudit/init?menuId=04.01.02","04.01.02");
		}
		
		
		//跳转开票页面
		function jumpOpenBilling(){
			addTab("订单开票","${ctx}/orderBilling/init?menuId=05.01.01","05.01.01");
		}
		
		//跳转开票申请页面
		function jumpBillingApply(){
			addTab("开票申请","${ctx}/billing/init?menuId=02.03.01","02.03.01");
		}
		
		function addTab(title, url, menuId){
			if (pp.$('#tabs').tabs('exists', title)){
				pp.$('#tabs').tabs('select', title);//选中并刷新
				var currTab = pp.$('#tabs').tabs('getSelected');
				if(url != undefined && currTab.panel('options').title != defTabName) {
					pp.$('#tabs').tabs('update',{
						tab:currTab,
						options:{
							content:createFrame(url, menuId)
						}
					})
				}
			} else {
				var content = createFrame(url, menuId);
				pp.$('#tabs').tabs('add',{
					title:title,
					content:content,
					closable:true
				});
			}
			/* tabClose(); */
		}
		
		function createFrame(url, menuId) {
			if(isEmpty(menuId)){
				try{
					menuId = url.substring(url.indexOf("menuId=") + 7);
				}catch(e){}
			}
			var s = '<iframe scrolling="auto" frameborder="0" id="tabFrame'+ menuId +'" src="'+url+'" style="width:100%;height:100%;"></iframe>';
			return s;
		}
	</script>
</html>
